package my.interview;

import java.util.*;

/**
 * @DESCRIPTION:
 * @USER: shg
 * @DATE: 2022/12/21 12:42
 */
public class NC61 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 获取target
        String input = scanner.nextLine();
        int target = Integer.parseInt(input);
        // 获取输入项
        String s = scanner.nextLine();
        String[] s1 = s.split(",");
        Integer[] integers = new Integer[s1.length];
        for (int i = 0; i < s1.length; i++) {
            integers[i] = Integer.valueOf(s1[i]);
        }

        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < integers.length; i++) {
            if (map.containsKey(target - integers[i])) {
                int[] ints = {map.get(target - integers[i]) + 1, i + 1};
                for (int anInt : ints) {
                    System.out.println(anInt);
                }
            } else {
                map.put(integers[i], i);
            }
        }

    }

}
